package com.zxy.ziems.server.sync.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * 同步类型
 */
@AllArgsConstructor
@Getter
public enum SyncEmsCimDayDataTypeEnum implements IEnum<String> {
    WATER("Water", "水"),
    AMMETER("Ammeter", "智能电表"),
    CQC("CQC", "大宗气体"),
    ;

    /**
     * 状态值
     */
    @EnumValue
    @JsonValue
    private final String code;
    /**
     * 状态名
     */
    private final String message;


    @Override
    public String getValue() {
        return code;
    }

    @JsonCreator
    public static SyncEmsCimDayDataTypeEnum getByCode(Integer status) {
        for (SyncEmsCimDayDataTypeEnum value : SyncEmsCimDayDataTypeEnum.values()) {
            if (Objects.equals(status, value.getCode())) {
                return value;
            }
        }
        return null;
    }
    
}
